FILE(GLOB EDP_FILES *.edp)

IF(NOT FREEFEM_MSH3_INSTALLED)
  LIST(REMOVE_ITEM EDP_FILES ${CMAKE_SOURCE_DIR}/examples/3dSurf/)
ENDIF(NOT FREEFEM_MSH3_INSTALLED)


IF(NOT FF_PLUGIN_TETGEN)
  LIST(REMOVE_ITEM EDP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/HeatTorus.edp)
ENDIF(NOT FF_PLUGIN_TETGEN)


IF(NOT FREEFEM_MEDIT_INSTALLED)
  LIST(REMOVE_ITEM EDP_FILES ${CMAKE_SOURCE_DIR}/examples/3dSurf/LaplacianSurf.edp)
  LIST(REMOVE_ITEM EDP_FILES ${CMAKE_SOURCE_DIR}/examples/3dSurf/buildMeshSfromMesh3.edp)
  LIST(REMOVE_ITEM EDP_FILES ${CMAKE_SOURCE_DIR}/examples/3dSurf/operatorsOnMeshS.edp)
ENDIF(NOT FREEFEM_MEDIT_INSTALLED)


# remove tests depending on freeyams library if not installed
IF(NOT FREEFEM_FREEYAMS_INSTALLED)
  LIST(REMOVE_ITEM EDP_FILES ${CMAKE_SOURCE_DIR}/examples/3dSurf/HeatTorus.edp)
ENDIF(NOT FREEFEM_FREEYAMS_INSTALLED)



# tests with without dependencies
FOREACH(EDP_FILE ${EDP_FILES})
  GET_FILENAME_COMPONENT(FILENAME ${EDP_FILE} NAME_WE)
  ADD_TEST(NAME ${FILENAME} COMMAND "${CMAKE_BINARY_DIR}/src/FreeFem++" ${EDP_FILE}
                            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/examples/3dSurf)
ENDFOREACH(EDP_FILE)
